package com.imodia.checkoo.service.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import com.hsq.commons.util.db.GenericIbatisDao;
import com.hsq.commons.util.db.annotation.SqlSpace;
import com.hsq.commons.util.db.dbUtil.UpdateFieldBean;
import com.imodia.checkoo.bean.CmsBaseSourceBean;
import com.imodia.checkoo.service.CmsBaseSourceService;


@SqlSpace(spaceName = "cmsbasesource")
@Service
public class CmsBaseSourceServiceImpl extends GenericIbatisDao<CmsBaseSourceBean, Integer> implements CmsBaseSourceService{
	
	private static final Log log = LogFactory.getLog(CmsBaseSourceServiceImpl.class);
	
		
	public int updateFieldValue(UpdateFieldBean obj){
		if(obj.getTableName()==null || obj.getTableName().trim().length()<=0){
			log.debug("________obj.getTableName()==null_____________");
			return -1;
		}
		if(obj.getFieldName()==null || obj.getFieldName().trim().length()<=0){
			log.debug("_______obj.getFieldName()______________");
			return -2;
		}
		if(obj.getKeyName()==null || obj.getKeyName().trim().length()<=0){
			log.debug("________obj.getKeyName()_____________");
			return -4;
		}
		if(obj.getKeyValue()==null || obj.getKeyValue().trim().length()<=0){
			log.debug("______obj.getKeyValue()_______________");
			return -5;
		}
		int x = super.getSqlDao().updateByField(obj);
		log.debug("______x:"+x);
		return x;	
	}
	

	

}